package cn.itsource;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableCircuitBreaker
public class ServiceOrderApplication1020 {
    public static void main(String[] args) {
//        new SpringApplicationBuilder(ServiceOrderApplication1020.class).web(true).run(args);
        SpringApplication.run(ServiceOrderApplication1020.class);
    }

    // 有这个注解才会采用轮询，随机等算法，RestTemplate相当于重新发送请求，如果没有使用ribbon就不能加这个注解
    @LoadBalanced
    @Bean
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

}
